/** *******************************************************************
 * FlexDatabaseManager
 * Copyright (c) 2008 Jonnie Spratley. All Rights Reserved.
 * @author  Jonnie Spratley
 * @contact jonniespratley@gmail.com
 * @internal
 ******************************************************************* */
package com.jonniespratley.flexdatabasemanager.business
{
	import com.adobe.cairngorm.business.ServiceLocator;
	import com.jonniespratley.flexdatabasemanager.vo.BackupVO;
	import com.jonniespratley.flexdatabasemanager.vo.DatabaseVO;
	import com.jonniespratley.flexdatabasemanager.vo.QueryVO;
	import com.jonniespratley.flexdatabasemanager.vo.TableStatusVO;
	import com.jonniespratley.flexdatabasemanager.vo.TableVO;
	import com.jonniespratley.flexdatabasemanager.vo.UserVO;
	
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;

	/**
	 * Service Delegate class 
	 * @author jonniespratley
	 * 
	 */	
	public class FlexDatabaseManagerDelegate
	{		
		private var responder:IResponder;
		private var service:Object;
		
		/**
		 * 
		 * @param responder
		 * 
		 */		
		public function FlexDatabaseManagerDelegate( responder:IResponder )
		{
			this.service = ServiceLocator.getInstance().getHTTPService( 'FDMService' );
			this.responder = responder;
		}

		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function checkLogin( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'ping' } );
				token.addResponder( responder );
				token.user = aUser;
				token.time = new Date();
		}		
		
		
		
		/*********************************************
		 * ANALYZE/OPTIMIZE/CHECK/REPAIR TABLES
		 *********************************************/
		 
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * @param aTable
		 * 
		 */		 
		public function analyzeTable( aUser:UserVO, aDatabase:DatabaseVO, aTable:TableStatusVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'analyzeTable', d: aDatabase.aDBName, t: aTable.tableName } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.mode = 'analyzeTable';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * @param aTable
		 * 
		 */		
		public function optimizeTable( aUser:UserVO, aDatabase:DatabaseVO, aTable:TableStatusVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'optimizeTable', d: aDatabase.aDBName, t: aTable.tableName } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.mode = 'optimizeTable';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * @param aTable
		 * 
		 */		
		public function checkTable( aUser:UserVO, aDatabase:DatabaseVO, aTable:TableStatusVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'checkTable', d: aDatabase.aDBName, t: aTable.tableName } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.mode = 'checkTable';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * @param aTable
		 * 
		 */		
		public function repairTable( aUser:UserVO, aDatabase:DatabaseVO, aTable:TableStatusVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'repairTable', d: aDatabase.aDBName, t: aTable.tableName } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.mode = 'repairTable';
				token.time = new Date();
		}
		
		
		
		/*********************************************
		 * CREATE DATEBASE/TABLE/USER
		 *********************************************/
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * 
		 */		
		public function createDatabase( aUser:UserVO, aDatabase:String ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'createDatabase', q: aDatabase } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.mode = 'createDatabase';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * @param aTable
		 * 
		 */		
		public function createTable( aUser:UserVO, aDatabase:DatabaseVO, aTable:String ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'createTable', d: aDatabase.aDBName, q: aTable } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.mode = 'createTable';
				token.time = new Date();
		}
		
		public function removeTable( aUser:UserVO, aDatabase:DatabaseVO, aTable:TableVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'removeTable', d: aDatabase.aDBName, q: aTable.tableName } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.mode = 'removeTable';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function createUser( aUser:UserVO, aNewUser:String ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'createUser', q: aNewUser } );
				token.addResponder( responder );
				token.user = aUser;
				token.newUser = aNewUser;
				token.time = new Date();
		}
		
		
		
		/*********************************************
		 * INSERT/UPDATE/REMOVE DATA
		 *********************************************/
 		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * @param aTable
		 * @param aField
		 * 
		 */ 		
		public function insertRecord( aUser:UserVO, aDatabase:DatabaseVO, aTable:TableVO, aQuery:String ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'insertRecord', d: aDatabase.aDBName, t: aTable.tableName, q: aQuery } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.query = aQuery;
				token.mode = 'insertRecord';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * @param aTable
		 * @param aField
		 * 
		 */		
		public function updateRecord( aUser:UserVO, aDatabase:DatabaseVO, aTable:TableVO, aQuery:String ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'updateRecord', d: aDatabase.aDBName, t: aTable.tableName, q: aQuery } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.query = aQuery;
				token.mode = 'updateRecord';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * @param aTable
		 * @param aField
		 * 
		 */		
		public function removeRecord( aUser:UserVO, aDatabase:DatabaseVO, aTable:TableVO, aQuery:String ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'removeRecord', d: aDatabase.aDBName, t: aTable.tableName, q: aQuery } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.query = aQuery;
				token.mode = 'removeRecord';
				token.time = new Date();
		}
		
		
		
		/*********************************************
		 * DATABASE/TABLE/FIELD INFO
		 *********************************************/
 		
		/**
		 * 
		 * @param aUser
		 * 
		 */ 		
		public function describeTable( aUser:UserVO, aDatabase:DatabaseVO, aTable:TableVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'describeTable' } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.mode = 'describeTable';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * @param aTable
		 * 
		 */		
		public function getTableColumns( aUser:UserVO, aDatabase:DatabaseVO, aTable:TableVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getTableColumns', d: aDatabase.aDBName, t: aTable.tableName } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.mode = 'getTableColumns';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function getDatabases( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getDatabases' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getDatabases';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function getDatabasesAndTables( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getDatabasesAndTables' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getDatabasesAndTables';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * @param aTable
		 * 
		 */		
		public function getTableIndex( aUser:UserVO, aDatabase:DatabaseVO, aTable:TableVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getTableIndex', d: aDatabase.aDBName, t: aTable.tableName } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.mode = 'getTableIndex';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * 
		 */		
		public function getTables( aUser:UserVO, aDatabase:DatabaseVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getTables', d: aDatabase.aDBName } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.mode = 'getTables';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function getServerInfo( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getServerInfo' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getServerInfo';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * @param aTable
		 * 
		 */		
		public function getTableData( aUser:UserVO, aDatabase:DatabaseVO, aTable:TableVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getTableData', d: aDatabase.aDBName, t: aTable.tableName } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.table = aTable;
				token.mode = 'getTableData';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function getUserInfo( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getUserInfo' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getUserInfo';
				token.time = new Date();
		}



		/*********************************************
		 * EXECUTE QUERY/ RESULT XML/JSON
		 *********************************************/
		
		/**
		 * 
		 * @param aUser
		 * @param aQuery
		 * 
		 */		
		public function executeQuery( aUser:UserVO, aQuery:QueryVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'executeQuery', q: aQuery.aQuery } );
				token.addResponder( responder );
				token.user = aUser;
				token.query = aQuery;
				token.mode = 'executeQuery';
				token.time = new Date();
		}
		
		public function analyzeQuery( aUser:UserVO, aQuery:QueryVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'analyzeQuery', q: aQuery.aQuery } );
				token.addResponder( responder );
				token.user = aUser;
				token.query = aQuery;
				token.mode = 'analyzeQuery';
				token.time = new Date();
		}
		
		public function explainQuery( aUser:UserVO, aQuery:QueryVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'explainQuery', q: aQuery.aQuery } );
				token.addResponder( responder );
				token.user = aUser;
				token.query = aQuery;
				token.mode = 'explainQuery';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function exportToJSON( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'exportToJSON' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'exportToJSON';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function executeQueryToXML( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'executeQueryToXML' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'executeQueryToXML';
				token.time = new Date();
		}
		
		
		
		/*********************************************
		 * MYSQL STATS
		 *********************************************/
		 
		/**
		 * 
		 * @param aUser
		 * 
		 */		 
		public function getBytes( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getBytes' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getBytes';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function getCommands( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getCommands' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getCommands';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function getConnections( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getConnections' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getConnections';
				token.time = new Date();
		}
		
		public function getHandlers( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getHandlers' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getHandlers';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function getInnoDb( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getInnoDb' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getInnoDb';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */					
		public function getKeys( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getKeys' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getKeys';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function getOpen( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getOpen' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getOpen';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function getQcache( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getQcache' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getQcache';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function getSort( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getSort' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getSort';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function getTemp( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getTemp' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getTemp';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function getThreads( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getThreads' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getThreads';
				token.time = new Date();
		}
		
		public function getPerformance( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getPerformance' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getPerformance';
				token.time = new Date();
		}
		
		
		public function getShowCommands( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getShowCommands' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getShowCommands';
				token.time = new Date();
		}
		
		public function getReplication( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getReplication' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getReplication';
				token.time = new Date();
		}
		
		public function getUptime( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getUptime' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getUptime';
				token.time = new Date();
		}
		
		public function getQuestions( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getQuestions' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getQuestions';
				token.time = new Date();
		}
		
		public function getDatabaseSpace( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getDatabaseSpace' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getDatabaseSpace';
				token.time = new Date();
		}
		
		
		
		/*********************************************
		 * SYSTEM INFORMATION
		 *********************************************/
		 
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function showSystemVariables( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'showSystemVariables' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'showSystemVariables';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function showSystemPrivileges( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'showSystemPrivileges' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'showSystemPrivileges';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function showSystemStatus( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'showSystemStatus' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'showSystemStatus';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function showSystemProcess( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'showSystemProcess' } );
				token.addResponder( responder );
				token.user = aUser;token.mode = 'showSystemProcess';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function showTableStatus( aUser:UserVO, aDatabase:DatabaseVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, d: aDatabase.aDBName, m: 'showTableStatus' } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.mode = 'showTableStatus';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * 
		 */		
		public function showSystemUsers( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'showSystemUsers' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'showSystemUsers';
				token.time = new Date();
		}
		
		
		
		/*********************************************
		 * BACKUPS/EXPORTS/IMPORTS
		 *********************************************/
		
 		/**
 		 * 
 		 * @param aUser
 		 * @param aDatabase
 		 * @param aBackup
 		 * 
 		 */		
 		public function createBackup( aUser:UserVO, aDatabase:DatabaseVO, aBackup:String ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'createBackup', d: aDatabase.aDBName, q: aBackup} );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.mode = 'createBackup';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * 
		 */		
		public function getDatabaseBackups( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'getDatabaseBackups' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'getDatabaseBackups';
				token.time = new Date();
		}
		
		/**
		 * 
		 * @param aUser
		 * @param aDatabase
		 * @param aBackup
		 * 
		 */		
		public function removeBackup( aUser:UserVO, aDatabase:DatabaseVO, aBackup:BackupVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'removeBackup', d: aDatabase.aDBName, q: aBackup.aFilename } );
				token.addResponder( responder );
				token.user = aUser;
				token.database = aDatabase;
				token.backup = aBackup;
				token.mode = 'removeBackup';
				token.time = new Date();
		}	
		
		public function killProcess( aUser:UserVO, aProcess:String ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'killProcess', q: aProcess } );
				token.addResponder( responder );
				token.user = aUser;
				token.process = aProcess;
				token.mode = 'killProcess';
				token.time = new Date();
		}	
		
		
		public function pollTraffic( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'pollTraffic' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'pollTraffic';
				token.time = new Date();
		}
		
		public function pollConnections( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'pollConnections' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'pollConnections';
				token.time = new Date();
		}
		
		public function pollQueries( aUser:UserVO ):void
		{
			var token:AsyncToken = this.service.send( { h: aUser.host, u: aUser.username, p: aUser.password, m: 'pollQueries' } );
				token.addResponder( responder );
				token.user = aUser;
				token.mode = 'pollQueries';
				token.time = new Date();
		}
		
		
	}
}